@extends('public.main')
@section('title', '睡前小测试|❤大千世界，我们并不是缺少一个说话的朋友，而是渴望一个理解自己读懂自己的伙伴。')

@section('css')
    <meta name="keywords" content="❤大千世界，我们并不是缺少一个说话的朋友，而是渴望一个理解自己读懂自己的伙伴。"/>
    <link rel="stylesheet" type="text/css" href="{{ asset('/static/css/index.css') }}">
@endsection

@section('content')
    <div class="col-md-12 col-xs-12">
        <div class="col-md-12 col-xs-12" style="margin:0px;padding:0px;">
            <div class="col-md-12 col-xs-12 content_left" style="margin:0px;padding:0px;">
                @foreach( $tests as $test)
                    <div class="col-sm-6 col-xs-12">
                        <div style="padding-bottom:10px;background: white;">
                            <div style="text-align: center">
                                <img src="{{ $test->imgurl }}" class="col-md-12 col-xs-12"
                                     style="padding:0px;margin:0px;height:100px;"/>
                                <div class="col-md-12 col-xs-12"
                                     style="margin-top:10px;margin-bottom:10px;">{{ $test->title }}</div>
                                <a type="button" class="btn btn-info" href="/testDetail/{{ $test->id }}.html">戳我开始</a>
                                <div style="margin-top:10px;color: #3d6983;font-size:10px;">人气：{{ $test->browse }}</div>
                            </div>
                        </div>
                    </div>
                @endforeach

            </div>

            <div class="col-md-12 col-xs-12" style="text-align: center">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        @if( $currentPage==1 )
                            <li class="disabled">
                                <a aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                        @else
                            <li>
                                <a href="/test_index?page={{ $currentPage-1 }}" aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                        @endif

                        @for($i=1;$i<=$page_num;$i++)
                            @if( $currentPage==$i )
                                <li class="active"><a href="/test_index?page={{ $i }}">{{ $i }}</a></li>
                            @else
                                <li><a href="/test_index?page={{ $i }}">{{ $i }}</a></li>
                            @endif
                        @endfor

                        @if( $currentPage==$page_num )
                            <li class="disabled">
                                <a aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                        @else
                            <li>
                                <a href="/test_index?page={{ $currentPage+1 }}" aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                        @endif
                    </ul>
                </nav>
            </div>
        </div>
    </div>
@endsection
